package com.wenwu.common.utils;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.map.ObjectMapper;

/**
 * @project ATHome-Manager
 * @class JsonUtils.java
 * @author zhujiagui E-mail:<zhujiagui@zkingsoft.com>
 * @date 2015年2月10日 下午2:47:41
 * @description json处理类
 */
public class JsonUtils {
	// 用来构建JsonGenerator对象
	public static JsonGenerator getJsonGenerator(HttpServletResponse response) throws IOException{
		response.setCharacterEncoding("UTF-8");  
	    response.setContentType("application/json; charset=utf-8");  
		return new ObjectMapper().getJsonFactory().createJsonGenerator(response.getOutputStream());
	}
}
